package com.itheima.mStringTest;

import java.util.Scanner;

/*
       一堆骚要求
 */
public class WorkStringTest04 {
    public static void main(String[] args) {
        //1.键盘录入一个字符串
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        char temp;
        //2.将该字符串变成字符数组(不能使用toCharArray()方法)
        char[] chr = new char[s.length()];
        for (int i = 0; i < s.length(); i++) {
            chr[i] = s.charAt(i);
            //3.将字符数组中的所有大写字母变成小写字母
            if (chr[i] >= 'A' && chr[i] <= 'Z') {
                chr[i] += 32;
            }
            //5.将偶数索引元素变为~
            if (i % 2 == 0) {
                chr[i] = '~';
            }
        }
        if (chr[0] != chr[s.length() - 1]) {
            temp = chr[0];
            chr[0] = chr[s.length() - 1];
            chr[s.length() - 1] = temp;
        }
        for (int i = 0; i < chr.length; i++) {
            System.out.print(chr[i]);
        }
    }
}
